package com.itheima.goods.feign;
import com.itheima.goods.pojo.Sku;
import com.itheima.util.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/****
 * @Author:itheima
 * @Description:
 *****/
@FeignClient(name="goods")
public interface SkuFeign {

    /***
     * 根据审核状态查询Sku
     * @param status
     * @return
     */
    @GetMapping("/sku/status/{status}")
    Result<List<Sku>> findByStatus(@PathVariable("status") String status);

    @PostMapping(value = "/sku/search" )
    Result<List<Sku>> findList(@RequestBody(required = false) Sku sku);

    /***
     * 根据ID查询Sku数据
     * @param id
     * @return
     */
    @GetMapping("/sku/{id}")
    Result<Sku> findById(@PathVariable("id") String id);

    /**
     * 库存扣减
     * @param dataMap
     * @return
     */
    @GetMapping("/sku/decr/count")
    Result desCount(@RequestParam Map<String, Integer> dataMap);
}